//
//  DetailWebViewController.m
//  Rong360
//
//  Created by tianliwei on 1/3/14.
//  Copyright (c) 2014 tianliwei. All rights reserved.
//

#import "DetailWebViewController.h"

@interface DetailWebViewController ()
@property (nonatomic, strong)UIScrollView *scrollView;
@property (nonatomic, strong)UIWebView *webView;
@property (nonatomic, strong)UITextView *textView;
@end

@implementation DetailWebViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (id)initWithContent:(NSString *)contentStr{
    self = [super init];
    if (self) {
//        self.content = [NSString stringWithFormat:@"<html> \n"
//                                                  "<head> \n"
//                                                  "<style type=\"text/css\"> \n"
//                                                  "body {font-size: %f; font-family: \"%@\"; color: %@;}\n"
//                                                  "</style> \n"
//                                                  "</head> \n"  
//                                                  "<body>%@</body> \n"  
//                                                  "</html>",16.0,@"Helvetica",@"#000000",contentStr];
        
        self.content = contentStr;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"详情";
    // Do any additional setup after loading the view from its nib.
//    self.webView.backgroundColor = [UIColor whiteColor];
//    self.webView = [[UIWebView alloc]initWithFrame:CGRectMake(8, 5, 304, UI_NAVIFRAME_HEIGHT-10)];
//    [self.webView loadHTMLString:self.content baseURL:nil];
//    [self.view addSubview:self.webView];
//    self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, UI_SCREEN_WIDTH, UI_NAVIFRAME_HEIGHT)];
//    self.scrollView.scrollEnabled = YES;
//    self.scrollView.userInteractionEnabled = YES;
//    self.scrollView.alwaysBounceVertical = YES;
    self.textView = [[UITextView alloc]initWithFrame:CGRectMake(8, 5, 304, UI_NAVIFRAME_HEIGHT-10)];
    self.textView.text = self.content;
    self.textView.editable = NO;
//    self.textView.scrollEnabled = YES;
//    self.textView.userInteractionEnabled = YES;
    self.textView.alwaysBounceVertical = YES;
//    self.textView.contentSize = CGSizeMake(UI_SCREEN_WIDTH, self.view.bounds.size.height+1);
    self.textView.font = [UIFont systemFontOfSize:16.0];
//    [self.scrollView addSubview:self.textView];
    [self.view addSubview:self.textView];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
